﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class DisplayValue : System.Web.UI.Page
{
    int ViewId;

    protected void Page_Load(object sender, EventArgs e)
    {
        ViewId = 0;

        if (Request.QueryString["ViewId"] != null)
        {
            ViewId = int.Parse(Request.QueryString["ViewId"]);

        }

        if (ViewId==0)
        {
            PrintQueryString();
        }

        if (ViewId==1)
	    {
            PrintCookies();
	    }

       
        if (ViewId == 2) 
        {
            PrintViewState();
        }

        if (ViewId == 3)
        {
            PrintSession();
        }

        else
        {
            NotImplimented();
        }
        MultiView1.ActiveViewIndex = ViewId;
    }


    private void PrintViewState() 
    {
        if (ViewState["FName"] != null)
        {
            LblVsFName.Text =this.ViewState["FName"].ToString();
        }
        if (ViewState["LName"] != null)
        {
            LblVsLName.Text =this .ViewState["LName"].ToString();
        }
        if (ViewState["Email"] != null)
        {
            LblVsEmail.Text =this.ViewState["Email"].ToString();
        }
        if (ViewState["Dob"] != null)
        {
            LblVsDob.Text = this.ViewState["Dob"].ToString();
        }
    
    }


    private void PrintSession() {

        if (Session["FName"] != null)
        {
            LblSesFName.Text = Session["FName"].ToString();
        }
        if (Session["LName"] !=null)
        {
            LblSesLName .Text = Session["LName"].ToString();
        }
        if (Session["Email"] != null)
	{
		 LblSesEmail.Text = Session["Email"].ToString();
	}
        if (Session["Dob"] != null)
	{
		 LblSesDob.Text=Session["Dob"].ToString();
	}
    }//End printsession




    private void PrintCookies() {

        
        
        if (Request.Cookies["FName"] !=null)
        {
            
             LblCookFName.Text =Server.HtmlEncode (Request.Cookies["FName"].Value.ToString());
        }
        
        if (Request.Cookies["LName"] != null)
	{
        LblCookLName.Text = Server.HtmlEncode(Request.Cookies["LName"].Value.ToString());
		 
	}
        if (Request.Cookies["EMail"] != null)
	{
        LblCookEMail.Text = Server.HtmlEncode(Request.Cookies["Email"].Value.ToString());
	}
        if (Request.Cookies["Dob"] != null)
	{
	  LblCookDob.Text = Server.HtmlEncode( Request.Cookies["Dob"].Value.ToString ()) ;
	}
    }


    private void PrintQueryString ()
    {
        if (Request.QueryString["FName"] != null)
        {
            LblqsFName.Text = (Request.QueryString["FName"]);
        }
        if (Request.QueryString ["LName"] != null)
        {
            LblqsLName.Text = (Request.QueryString["LName"]);
        }
        if (Request.QueryString ["EMail"] != null)
        {
            LblqsEmail.Text = (Request.QueryString["EMail"]);
        }
        if (Request.QueryString ["Dob"] != null)
        {
            LblqsDob.Text = (Request.QueryString["Dob"]);
        }
    }


    private void NotImplimented (){

        Response.Write("Not Implimented");
    }
}//End Class
